//https://leetcode.cn/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/
class Solution {
public:
    int search(vector<int>& nums, int target) {
        map<int, int> cnt;
        for (auto i : nums)
        {
            map<int, int>::iterator it = cnt.find(i);
            if (it != cnt.end())
            {
                ++it->second;
            }
            else
            {
                cnt.insert(make_pair(i, 1));
            }
        }

        return cnt.find(target)->second;
    }
};